#ifndef SYNTAXTREENODE_H
#define SYNTAXTREENODE_H

class SyntaxTreeNode
{
private:
	SyntaxTreeNode* m_Parent;
	Symbol m_Node;
	QList<SyntaxTreeNode*> m_Children;

public:
	SyntaxTreeNode(){}
	SyntaxTreeNode(Symbol s) : m_Node(s), m_Parent(NULL) {}
	~SyntaxTreeNode() 
	{
		for(int i = 0; i < m_Children.size(); ++i)
		{
			delete m_Children[i];
		}
	}

	SyntaxTreeNode* addChild(Symbol s)
	{
		SyntaxTreeNode* ret = new SyntaxTreeNode(s);
		ret->setParent(this);
		m_Children.append(ret);

		return ret;
	}

	qint32 childrenCount() { return m_Children.size(); }

	SyntaxTreeNode* parent(){ return m_Parent; }
	void setParent(SyntaxTreeNode* parent){ m_Parent = parent; }
	SyntaxTreeNode* childAt(qint32 i){ return m_Children.at(i); }

	Symbol symbol(){ return m_Node; } 
};

#endif // SYNTAXTREENODE_H